package com.jcake.services.client;

public class InvocationWrapper {

	public enum InvocationStatus {
		STATUS_OK, STATUS_ERROR
	}

	private Invocation invocation;
	private InvocationStatus status;
	private Exception exception;

	public InvocationWrapper() {
	}

	public InvocationWrapper(Invocation invocation) {
		this.invocation = invocation;
	}

	public Invocation getInvocation() {
		return invocation;
	}

	public void setInvocation(Invocation invocation) {
		this.invocation = invocation;
	}

	public InvocationStatus getStatus() {
		return status;
	}

	public void setStatus(InvocationStatus status) {
		this.status = status;
	}

	public Exception getException() {
		return exception;
	}

	public void setException(Exception exception) {
		this.exception = exception;
	}

	@Override
	public String toString() {
		StringBuilder buff = new StringBuilder();
		buff.append("InvocationWrapper[\n");
		buff.append("\t"); buff.append(invocation == null ? "invocation: <null>" : invocation).append("\n");
		buff.append("\t").append(status == null ? "status: <null>" : status).append("\n");
		buff.append("\t").append(exception == null ? "exception: <null>" : exception.getClass().getName() + ": " + exception.getMessage()).append("\n");
		buff.append("]");
		return buff.toString();
	}
}
